<div class="hbox hbox-auto-xs hbox-auto-sm" ng-init="
    app.settings.asideFolded = false;
    app.settings.asideDock = false;
  ">
    <!-- main -->
    <div class="col">
        <!-- main header -->
        <div class="bg-light lter b-b wrapper-md">
            <div class="row">
                <div class="col-sm-6 col-xs-12">
                    <h1 class="m-n font-thin h3 text-black">持续集成组管理</h1>
                    <!--<small class="text-muted">可访问堡垒机列表管理</small>-->
                </div>
            </div>
        </div>
        <!-- / main header -->
        <div class="wrapper-md">
            <!-- toaster directive -->
            <toaster-container
                    toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
            <!-- / toaster directive -->

            <uib-tabset>
                    <div ng-controller="cigroupsCtrl">
                        <div style="margin-top: 5px;" class="panel panel-default">
                            <div class="panel-body">
                                <form class="form-inline" role="form">
                                    <div class="form-group">
                                        <div class="input-group">
                                            <span class="input-group-addon">组名称</span>
                                            <input type="text" class="form-control" ng-model="queryName"
                                                   placeholder="组名称">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="input-group">
                                            <span class="input-group-addon">环境类型</span>
                                            <select class="form-control" ng-model="nowEnv"
                                                    ng-options="envItem.code as envItem.name for envItem in envType"
                                                    required>
                                                <option value="">--请选择--</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <button type="button" class="btn btn-info" ng-click="doQuery()"><span
                                                class="glyphicon glyphicon-search"></span>搜索
                                        </button>
                                    </div>
                                    <button type="button" class="btn btn-info" ng-click="reSet()"><span
                                            class="glyphicon glyphicon-repeat"></span>重置
                                    </button>
                                    <button type="button" class="btn btn-success" ng-click="doRefresh()"><span
                                            class="glyphicon glyphicon-refresh"></span>同步数据
                                    </button>
                                </form>
                                <div style="margin-top: 5px;">
                                    <table class="table table-hover table-bordered table-striped">
                                        <thead>
                                        <tr>
                                            <td>权限组名称</td>
                                            <td>说明</td>
                                            <td>服务器组名称</td>
                                            <td>环境</td>
                                            <td>更新时间</td>
                                            <td>操作</td>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <tr ng-repeat="item in pageData">
                                            <!--用户信息-->
                                            <td>
                                                {{item.groupName}}
                                            </td>
                                            <td>
                                                <span ng-show="item.content != ''">{{item.content}}</span>
                                                <span ng-show="item.content == ''">{{item.serverGroupDO.content}}</span>
                                            </td>
                                            <td>
                                                {{item.serverGroupDO.name}}
                                            </td>
                                            <td>
                                                <b style="color: #777" ng-if="item.envType == 0">ALL</b>
                                                <b style="color: #5bc0de" ng-if="item.envType == 1">dev</b>
                                                <b style="color: #449d44" ng-if="item.envType == 2">daily</b>
                                                <b style="color: #ec971f" ng-if="item.envType == 3">gray</b>
                                                <b style="color: #d9534f" ng-if="item.envType == 4">prod</b>
                                                <b style="color: #5e5e5e" ng-if="item.envType == 5">test</b>
                                                <b style="color: #286090" ng-if="item.envType == 6">back</b>
                                            </td>
                                            <td>{{item.gmtCreate}}</td>
                                            <td>
                                                <button ng-click="editCigroup(item)"
                                                        class="btn btn-xs"
                                                        style="margin-left: 5px; background-color: #2e6da4; color: white;">
                                                    <span class="glyphicon glyphicon-edit"></span>编辑</button>

                                                <button ng-click="memberList(item)"
                                                        class="btn btn-xs"
                                                        uib-popover-html="'用户详情'" popover-trigger="'mouseenter'"
                                                        style="margin-left: 5px; background-color: #2e6da4; color: white;">
                                                    <span class="icon icon-users"></span>用户</button>

                                                <button ng-click="delCigroup(item)"
                                                        class="btn btn-xs pull-right"
                                                        style="background-color: red; color: white;">
                                                    <span class="glyphicon glyphicon-remove"></span>删除</button>

                                                <!--<span class="glyphicon glyphicon-trash pull-right"-->
                                                        <!--ng-click="delCigroup(item)">-->
                                                <!--</span>-->
                                                <!--<span class="icon icon-users" style="margin-left: 20px;"-->
                                                      <!--uib-popover-html="'用户列表'" popover-trigger="'mouseenter'"-->
                                                        <!--ng-click="memberList(item)">-->
                                                <!--</span>-->
                                                <!--<span class="glyphicon glyphicon-pencil pull-left"-->
                                                        <!--ng-click="editCigroup(item)">-->
                                                <!--</span>-->
                                            </td>
                                        </tr>
                                        </tbody>
                                        <tfoot>
                                        <tr>
                                            <td colspan="6">
                                                <ul style="margin: 0px; float: right;" uib-pagination
                                                    total-items="totalItems" ng-model="currentPage"
                                                    items-per-page="pageLength" max-size="10" ng-change="pageChanged()"
                                                    previous-text="&lsaquo;" next-text="&rsaquo;"></ul>
                                            </td>
                                        </tr>
                                        </tfoot>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
            </uib-tabset>
        </div>
    </div>
    <!-- / main -->
</div>

<script type="text/ng-template" id="cigroupsInfo">
    <div ng-include="'tpl/modal/cigroups_info_modal.html'"></div>
</script>
